import { IPSSysBICube } from './ipssys-bicube';
import { IPSSysBICubeDimension } from './ipssys-bicube-dimension';
import { IPSSysBICubeMeasure } from './ipssys-bicube-measure';
import { IPSDataEntity } from '../dataentity/ipsdata-entity';
import { IPSDEField } from '../dataentity/defield/ipsdefield';
import { PSModelObjectImpl } from '../psmodel-object-impl';

export class PSSysBICubeImpl extends PSModelObjectImpl implements IPSSysBICube {
  protected allpssysbicubedimensions: IPSSysBICubeDimension[] | null = null;

  getAllPSSysBICubeDimensions(): IPSSysBICubeDimension[] | null {
    if (this.allpssysbicubedimensions == null) {
      this.allpssysbicubedimensions = this.fillChildListModel(this.M.getAllPSSysBICubeDimensions, 'bi.IPSSysBICubeDimension') as IPSSysBICubeDimension[];
    }
    return this.allpssysbicubedimensions;
  }

  get allPSSysBICubeDimensions(): IPSSysBICubeDimension[] | null {
    return this.getAllPSSysBICubeDimensions();
  }

  findPSSysBICubeDimension(objKey: any): IPSSysBICubeDimension | null {
    return this.getPSModel5('bi.IPSSysBICubeDimension', this.getAllPSSysBICubeDimensions(), objKey) as IPSSysBICubeDimension;
  }

  protected allpssysbicubemeasures: IPSSysBICubeMeasure[] | null = null;

  getAllPSSysBICubeMeasures(): IPSSysBICubeMeasure[] | null {
    if (this.allpssysbicubemeasures == null) {
      this.allpssysbicubemeasures = this.fillChildListModel(this.M.getAllPSSysBICubeMeasures, 'bi.IPSSysBICubeMeasure') as IPSSysBICubeMeasure[];
    }
    return this.allpssysbicubemeasures;
  }

  get allPSSysBICubeMeasures(): IPSSysBICubeMeasure[] | null {
    return this.getAllPSSysBICubeMeasures();
  }

  findPSSysBICubeMeasure(objKey: any): IPSSysBICubeMeasure | null {
    return this.getPSModel5('bi.IPSSysBICubeMeasure', this.getAllPSSysBICubeMeasures(), objKey) as IPSSysBICubeMeasure;
  }

  get codeName(): string {
    return this.M.codeName;
  }

  get cubeTag(): string {
    return this.M.cubeTag;
  }

  get cubeTag2(): string {
    return this.M.cubeTag2;
  }

  get dynaModelFilePath(): string {
    return this.M.dynaModelFilePath;
  }

  protected keypsdefield: IPSDEField | null = null;

  getKeyPSDEField(): IPSDEField | null {
    if (this.keypsdefield != null) return this.keypsdefield;
    const value = this.M.getKeyPSDEField;
    if (value == null) {
      return null;
    }
    const ipsdataentity = this.getPSDataEntity();
    if (ipsdataentity != null) {
      this.keypsdefield = ipsdataentity.findPSDEField(value);
    }
    return this.keypsdefield;
  }

  get keyPSDEField(): IPSDEField | null {
    return this.getKeyPSDEField();
  }

  getKeyPSDEFieldMust(): IPSDEField {
    const value = this.getKeyPSDEField();
    if (value == null) {
      throw new Error('未指定键值存储属性');
    }
    return value;
  }

  get memo(): string {
    return this.M.memo;
  }

  get name(): string {
    return this.M.name;
  }

  protected psdataentity: IPSDataEntity | null = null;

  getPSDataEntity(): IPSDataEntity | null {
    if (this.psdataentity != null) return this.psdataentity;
    const value = this.M.getPSDataEntity;
    if (value == null) {
      return null;
    }
    this.psdataentity = this.getPSModel4('dataentity.IPSDataEntity', value, 'getPSDataEntity') as IPSDataEntity;
    return this.psdataentity;
  }

  get psDataEntity(): IPSDataEntity | null {
    return this.getPSDataEntity();
  }

  getPSDataEntityMust(): IPSDataEntity {
    const value = this.getPSDataEntity();
    if (value == null) {
      throw new Error('未指定实体');
    }
    return value;
  }

  protected typepsdefield: IPSDEField | null = null;

  getTypePSDEField(): IPSDEField | null {
    if (this.typepsdefield != null) return this.typepsdefield;
    const value = this.M.getTypePSDEField;
    if (value == null) {
      return null;
    }
    const ipsdataentity = this.getPSDataEntity();
    if (ipsdataentity != null) {
      this.typepsdefield = ipsdataentity.findPSDEField(value);
    }
    return this.typepsdefield;
  }

  get typePSDEField(): IPSDEField | null {
    return this.getTypePSDEField();
  }

  getTypePSDEFieldMust(): IPSDEField {
    const value = this.getTypePSDEField();
    if (value == null) {
      throw new Error('未指定类型存储属性');
    }
    return value;
  }

  get userCat(): string {
    return this.M.userCat;
  }

  get userTag(): string {
    return this.M.userTag;
  }

  get userTag2(): string {
    return this.M.userTag2;
  }

  get userTag3(): string {
    return this.M.userTag3;
  }

  get userTag4(): string {
    return this.M.userTag4;
  }

  get cls(): string {
    return 'PSSysBICubeImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'bi.IPSBICube' || cls == 'bi.IPSSysBICube') return true;
    return super.instanceof(cls);
  }
}
